{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Grove ADC Example\n",
    "\n",
    "This example shows how to use the Grove ADC.\n",
    "\n",
    "A Grove I2C ADC (v1.2) and PYNQ Grove Adapter are required. An analog input is also required. In this example, the Grove slide potentiometer was used.\n",
    "\n",
    "In the example, the ADC is initialized, a test read is done, and then the sensor is set to log a reading every 100 milliseconds. The ADC can be connected to any Grove peripheral that provides an analog voltage. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. Using Pmod to Grove Adapter\n",
    "This example uses the PYNQ Pmod to Grove adapter. The adapter is connected to PMODA, and the grove ADC is connected to group `G4` on adapter.\n",
    "### 1. Simple ADC read()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from pynq.overlays.base import BaseOverlay\n",
    "base = BaseOverlay(\"base.bit\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.2866 V\n"
     ]
    }
   ],
   "source": [
    "from pynq.lib.pmod import Grove_ADC\n",
    "from pynq.lib.pmod import PMOD_GROVE_G4 \n",
    "\n",
    "grove_adc = Grove_ADC(base.PMODA,PMOD_GROVE_G4)\n",
    "print(\"{} V\".format(round(grove_adc.read(),4)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2. Starting logging once every 100 milliseconds"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "grove_adc.set_log_interval_ms(100)\n",
    "grove_adc.start_log()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3. Try to change the input signal during the logging. \n",
    "\n",
    "For example, if using the Grove slide potentiometer, move the slider back and forth (slowly). \n",
    "\n",
    "Stop the logging whenever done trying to change sensor's value."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "log = grove_adc.get_log()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 4. Plot values over time\n",
    "The voltage values can be logged and displayed."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false,
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXEAAAEKCAYAAADkYmWmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X2UHHWd7/H3N4SYkAABExITZDIOcsXVVdd7IYqaSdYg\nD7uw5+qKOAGDXHW9Gl0eVFbIzmQH9+qeqMGoy+aaNQaCwuoKccUlcMNcrhwGHyALQrLCpKeJA5kQ\nSdAJGczD9/5RVZOaTvdMz0xPd1XX53VOn+6uqqn+dnXPt3/1eypzd0REJJ0m1DoAEREZPSVxEZEU\nUxIXEUkxJXERkRRTEhcRSTElcRGRFFMSF6kAM7vfzD5c6zgke5TEM8rMPmBmnWbWZ2Y7zewhM/t4\nreOKM7PtZvarIss7zGy/mb1oZnvN7Odm9jkzm1Sw3RlmdoeZPW9me8xsi5ldZWZWsN0cMztgZo1F\nXuuHZvYPI4z7Q2b2/0byN5ViZgvMbEctXltqQ0k8g8zsGuCrwJeAWe4+G/gr4O1mdmyJv6nqd8XM\n3gW8AjjFzN5asNqB/+nuJwKvAq4BPgDcHfv7JqATyANvcPeTgL8E/gQ4ftDO3J8F7gMuK4jhJOB8\nYN1Iww9jrBWN4MsQJfGMMbMTgBXAx939h+6+D8Dd/8PdL3P3A+F23zazb5rZj83s90CzmZ1gZuvN\nbJeZ5czs+nDbSWFJ9/Wx15lhZi+Z2Yzw+Z+Z2aPhdj81szcOE+qHgO8DdwJLi72VMO797v4AcBHw\nNjO7IFy/AnjQ3T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BB75hHgUfCuE4G7gvj2wRM\nr1UjBbCAIw2bNY8LeBPBj/AWgpLJiQmJ6zMEPyiPAd8h6PVU9biA24BngZcJ6uivIGhwLRoH8DcE\nPRq2AudWOa6ngHz4vX8E+GYS4ipYv52wYbNacZU4VhOBW4DHgV8QTCNS1WNV7k2DfUREUiyTDZsi\nIvVCSVxEJMWUxEVEUkxJXEQkxZTERURSTElcRCTFlMRFRFJMSVxEJMX+P4UwGRWhQijsAAAAAElF\nTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x31648f70>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "plt.plot(range(len(log)), log, 'ro')\n",
    "plt.title('Grove ADC Voltage Log')\n",
    "plt.axis([0, len(log), min(log), max(log)])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. Using Arduino Shield\n",
    "This example uses the PYNQ Arduino shield. The grove ADC can be connected to any of the `I2C` groups on the shield.\n",
    "### 1. Instantiation and read a single value"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.2832 V\n"
     ]
    }
   ],
   "source": [
    "from pynq.lib.arduino import Grove_ADC\n",
    "from pynq.lib.arduino import ARDUINO_GROVE_I2C\n",
    "grove_adc = Grove_ADC(base.ARDUINO,ARDUINO_GROVE_I2C)\n",
    "print(\"{} V\".format(round(grove_adc.read(),4)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2. Starting logging once every 100 milliseconds"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "grove_adc.set_log_interval_ms(100)\n",
    "grove_adc.start_log()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 3. Try to change the input signal during the logging. \n",
    "\n",
    "For example, if using the Grove slide potentiometer, move the slider back and forth (slowly). \n",
    "\n",
    "Stop the logging whenever done trying to change sensor's value."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "log = grove_adc.get_log()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 4. Plot values over time\n",
    "The voltage values can be logged and displayed."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXEAAAEKCAYAAADkYmWmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X+UHHWZ7/H3EyMmTEwCcp1IkEkY4C4oiuLFYNabDoIL\nZCXeVVdhhhjwqutFxEB0WTXOjHH3rJ4oID+WZUViIIAsCkTQw48b+3JhDSiQCybBxUnPGAOZGIEk\nQxIM5Ll/VNVMpdMz0zP9o7q6P69z+qS7urrmW92dp6u+3+f5lrk7IiKSTuOSboCIiIydgriISIop\niIuIpJiCuIhIiimIi4ikmIK4iEiKKYiLlIGZ/cLMLki6HdJ4FMQblJl9wszWmFm/mW0xs1+a2eeS\nblecmW00s98UWJ41s91mtt3MXjKzX5nZ35vZQXnrHWtmt5vZH83sRTNba2aLzMzy1jvczPaa2cwC\nf+tOM/v2KNv9STP7v6N5TbmY2Rwz25TE35ZkKIg3IDO7FLgc+BbQ7O7TgL8D3mdmrx/iNVX9rpjZ\nfwfeALzZzE7Ke9qB/+XuU4C3AJcCnwB+Fnt9K7AG6AXe7u6HAB8D3g28cb+NuT8HPAicl9eGQ4Az\ngeWjbX7YxqSogq+BKIg3GDObDHQBn3P3O939ZQB3/3/ufp677w3Xu9HMrjWze81sJ5Axs8lmtsLM\ntppZzsy+Gq57UHike3zs7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IEuuApwgGAl+fln0BbgGeA14h\n6Nc/HzhkqLYTZHf8jiBJ4INJt7+IfXmWYFr6J8LbtbWyLyr2ERFJMQ1sioikmIK4iEiKKYiLiKSY\ngriISIopiIuIpJiCuIhIiimIi4ikmIK4iEiK/X/v/TG0Vyj/igAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x3057b590>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "plt.plot(range(len(log)), log, 'ro')\n",
    "plt.title('Grove ADC Voltage Log')\n",
    "plt.axis([0, len(log), min(log), max(log)])\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.4.3+"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
